<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2 id="test">尝试修改h2标签中的内容</h2>
    <button onclick="update()">点击按钮修改h2标签中内容</button>
</body>
<script type="text/javascript">
    function update(){
        var h2 = document.getElementById('test');
        h2.innerHTML = "修改后的内容";
    }
</script>
</html>